<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增流程定义节点信息')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-definitionNode-add">
            <input type="hidden" name="definitionInfoId" th:value="${definitionInfoId}">
            <div class="form-group">    
                <label class="col-sm-3 control-label">节点key：</label>
                <div class="col-sm-8">
                    <input name="nodeKey" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">节点描述：</label>
                <div class="col-sm-8">
                    <input name="nodeDescription" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">审核人：</label>
                <div class="col-sm-8">
                    <select id="auditorId" name="auditors" class="form-control select2-multiple" multiple>
                        <option th:each="auditor:${auditors}" th:value="${auditor.userId}" th:text="${auditor.userName}"></option>
                    </select>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        const definitionInfoId = [[${definitionInfoId}]];
        const prefix = ctx + "business/definitionNode";
        $("#form-definitionNode-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                const data = $("#form-definitionNode-add").serializeArray();
                const auditorIds = $.form.selectSelects("auditorId");
                data.push({"name": "auditorIds", "value": auditorIds});
                data.push({"name": "definitionInfoId", "value": definitionInfoId});
                $.operate.save(prefix + "/add", data);
            }
        }
    </script>
</body>
</html>